<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>文章添加--layui后台管理模板</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<style>
		html{ padding: 10px}
	</style>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote">文章编辑</blockquote>
<form class="layui-form" id="bd1">


	<div class="layui-form-item">
		<label class="layui-form-label">文章标题</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input newsName" lay-verify="title" value="{$t.Title}" name="Title" placeholder="请输入文章标题">
		</div>
	</div>


	<div class="layui-form-item">



		<div class="layui-inline">
			<label class="layui-form-label">所属分类</label>
			<div class="layui-input-inline">
				<select class="newsLook" name="BusModelID" lay-filter="browseLook">

					<option value="0"></option>

					{volist name="catelist" id="v"}
					{eq name="v.ID" value="$t.BusModelID"}
					<option value="{$v.ID}" selected>{$v.CategoryName}</option>

					{else /}

					<option value="{$v.ID}">{$v.CategoryName}</option>
					{/eq}

					{/volist}

				</select>
			</div>
		</div>

	</div>

	<div class="layui-form-item">


		<div class="layui-inline">
			<label class="layui-form-label">文章属性</label>
			<div class="layui-input-block">
				<input type="checkbox" name="tuijian" class="tuijian"  title="推荐">
				<input type="checkbox" name="ISTop" class="newsStatus" title="置顶">
				<input type="checkbox" name="ISHomePage" class="isShow" title="首页">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">阅读量</label>
			<div class="layui-input-inline">
				<input type="text" name="PageNum" class="layui-input newsAuthor" lay-verify="required"  value="{$t.PageNum}">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">来源</label>
			<div class="layui-input-inline">
				<input type="text" class="layui-input newsTime" >
			</div>
		</div>

	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">缩略图400*240</label>
		<div class="layui-input-block">

			{empty name="t.ImageUrl" }
			<img src="{:_STATIC}/img/nopic2.jpg" width="400" height="240" id="pic" />
			{else /}
			<img src="{$t.ImageUrl}" width="400" height="240" id="pic" />

            {/empty}
		</div>

		<input name="ImageUrl" type="hidden" id="picval" value="{$t.ImageUrl}" />
	</div>


	<div class="layui-form-item">
		<label class="layui-form-label">关键字</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" name="KeyWord" placeholder="请输入文章关键字" value="{$t.KeyWord}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">内容摘要</label>
		<div class="layui-input-block">
			<textarea placeholder="请输入内容摘要" name="Abstract" class="layui-textarea">{$t.Abstract}</textarea>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">文章内容</label>
		<div class="layui-input-block">
				<textarea name="Content" id="news_content" style="height: 600px">


					{$t.Content}
				</textarea>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
		<input type="hidden" name="tid" value="{$t.ID}">
			<button class="layui-btn" type="button"  lay-submit="" lay-filter="addNews" >立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>
{:jq()}
{:layui()}
{:ue()}
<script type="text/javascript">
    layui.upload.render({
        elem: '#pic'
        ,url: "{:url('api/upload/qiniu')}"
        ,size: 2048 //限制文件大小，单位 KB
        ,done: function(res){
           $("#pic").attr('src',res.url);
           $("#picval").val(res.url);
            
        }
    });
    var ue = UE.getEditor('news_content',{

        height:700
    });

    layui.form.on('submit(addNews)', function(data){

       $.post("{:url('checknews')}",data.field,function(res){

           if(res.code==200){

             layer.alert('保存成功',function(){

                 history.go(-1);

			 });



		   }else{



           }


	   })
    });


</script>
</body>
</html>